<template>
  <!-- 容器 -->
  <div id="container"></div>
</template>

<script>
import * as Cesium from "cesium/Cesium"; // api导入
import "cesium/Widgets/widgets.css"; // 样式导入
// import china from '../config/100000.geoJson'
export default {
  name: "HelloWorld",
  mounted() {
    this.initModel();
  },
  data() {
    return {};
  },
  methods: {
    initModel() {
      // defaultAccessToken是访问的token,没有的要去官网注册账户
      Cesium.Ion.defaultAccessToken =
        "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIwZDMzMWQzYi01NDcyLTQzZDYtYmNmNy1iNDdmYzJlNTZkNTEiLCJpZCI6MTY0MzEwLCJpYXQiOjE2OTM4MTM1NDl9.l2Mocdo0ZiRjzLC9INU7p_Y6wZuiRXJ3T1eW3s0aB7c";
      // 初始化球体
      const chinaPosition = Cesium.Cartesian3.fromDegrees(
        120.86,
        32.01,
        20000.0
      );
      const viewer = new Cesium.Viewer("container");








      viewer.camera.flyTo({
        destination: chinaPosition, // 目的地位置
        orientation: {
          heading: Cesium.Math.toRadians(0.0), // 方向
          pitch: Cesium.Math.toRadians(-90.0), // 倾斜角度
          roll: 0.0,
        },
        duration: 6.0, // 飞行时间
      });

      console.log(
        chinaPosition,
        "------------",
        Cesium
      );
    },
  },
};
</script>

<style scoped>
#container {
  width: 100vw;
  height: 100vh;
}
</style>
